﻿namespace Sidvall.IdentityManager.Data.Keys
{
    public class AspNetUserLoginsKey
    {
        public string LoginProvider { get; set; }
        public string ProviderKey { get; set; }
        public string UserId { get; set; }
        
        public static AspNetUserLoginsKey GetKey(IAspNetUserLogins item)
        {
            if (item == null)
                return null;
            if (item.LoginProvider == null)
                return null;
            if (item.ProviderKey == null)
                return null;
            if (item.UserId == null)
                return null;
            return new AspNetUserLoginsKey()
            {
                LoginProvider = item.LoginProvider,
                ProviderKey = item.ProviderKey,
                UserId = item.UserId,
            };
        }
        public static AspNetUserLoginsKey GetKey(string loginProvider, string providerKey, string userId)
        {
            if (loginProvider == null)
                return null;
            if (providerKey == null)
                return null;
            if (userId == null)
                return null;
            return new AspNetUserLoginsKey()
            {
                LoginProvider = loginProvider,
                ProviderKey = providerKey,
                UserId = userId,
            };
        }
    }
}